#ifndef WIDGET_H
#define WIDGET_H

#include <head/g_functionbase.h>
#include "common/baseresteditor.h"
#include "cl_additem.h"
#include "v_additem.h"
#include "d_additem.h"
#include "m_columns.h"

namespace Ui {
class Widget;
}

class Widget : public BaseRestEditor
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = nullptr);
    ~Widget();

    void generateMenu(){}
    void updateMenu();
    void customKeyEvent(QKeyEvent *event);
    void updateListView();
    void updateTableView();
    void onReceivedObject(const QJsonObject &object);

    void processChangeLog(const QJsonObject &object);
    void processVersion(const QJsonObject &object);
    void processDemand(const QJsonObject &object);

    void newItem();
    void editItem();
    void delayUpdateView();
    void do_changeFinish();
    void do_changeCancel();

    void onAddItem(const QJsonObject &obj);
    void onUpdateItem(const QJsonObject &obj);

private slots:
    void on_listView_doubleClicked(const QModelIndex &index);
    void on_btn_changeLog_clicked();
    void on_btn_version_clicked();
    void on_btn_demand_clicked();

private:
    Ui::Widget *ui;

    int selectId;
    QString _title;

    QString selectEntry;
    QStringList entries;
    QStringList versionList;
};

#endif // WIDGET_H
